package com.flash.ReportManagement.controller;


import com.flash.ReportManagement.Service.CashPositionStatementService;
import com.flash.ReportManagement.entity.CashPositionStatement;
import com.flash.ReportManagement.entity.RollDifference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

@RestController
public class CashPositionStatementController {
    @Autowired
    CashPositionStatementService cashPositionStatementService;

    @RequestMapping("selectCashPositionStatement")
    public Map<String,Object> selectCashPositionStatement(String dateAccrualStock){
        System.out.println("进入可用现金寸头报表controller");
        Map<String, Object> map = cashPositionStatementService.selectCashPositionStatement(dateAccrualStock);
        List<CashPositionStatement> cashPositionStatementList = (List<CashPositionStatement>) map.get("cashPositionStatementList");
        Iterator<CashPositionStatement> iterator = cashPositionStatementList.iterator();
        while (iterator.hasNext()){
            CashPositionStatement difference = iterator.next();
            if(difference.getMoney()==0){
                iterator.remove();
            }
        }
        //以layui要求存储响应数据格式
        Map<String, Object> json = new HashMap<>();
        json.put("code",0);
        json.put("msg","");
        json.put("count",10);
        json.put("data",cashPositionStatementList);
        return json;
    }
}
